<?php
namespace Admin\Controller;
use Think\Controller;
class MainController extends AclController {
    function resetPWD($user=''){
        $o=json_decode($user);
        $row=M('admins')->where(array('username'=>$o->username,'pwd'=>md5($o->pwd)))->find();
        if(!$row){
            $this->ajaxReturn(array('status'=>'400','msg'=>'原始密码错哦~'));
        }else{
            $res=M('admins')->where(array('id'=>$o->id))->setField('pwd',md5($o->newPwd)); 
            session_destroy();
            $this->ajaxReturn(array('status'=>'200','msg'=>'修改成功！请重新登陆'));

        }

    }
}